package com.cn.ant.common.sms;

import com.shcm.send.DataApi;
import com.shcm.send.OpenApi;
import java.io.UnsupportedEncodingException;

public class SMSUtils
{
    private static String sOpenUrl = "http://smsapi.c123.cn/OpenPlatform/OpenApi";
    private static String sDataUrl = "http://smsapi.c123.cn/DataPlatform/DataApi";
    private static final String account = "1001@500726740003";
    private static final String authkey = "71305EA7B496A81AEFB295D84E420DFC";
    private static final int cgid = 4056;
    private static final int csid = 0;

    public static int send(String mobile, String smsContent)
    {
        OpenApi.initialzeAccount(sOpenUrl, account, authkey, 4056, 0);

        DataApi.initialzeAccount(sDataUrl, account, authkey);
        int nRet = 0;
        try {
            smsContent = new String(smsContent.getBytes("UTF-8"), "UTF-8");
            nRet = OpenApi.sendOnce(mobile, smsContent, 0, 0, null);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return nRet;
    }

    public static void main(String[] args) {
        SMSUtils.send("15815546668", "测试短信");
    }
}